<template>
  <div>
    <el-dialog
      :visible.sync="dialogVisible"
      :before-close="handleClose"
      width="50%">
      <el-descriptions title="订单信息" :column="2">
        <el-descriptions-item label="订单编号">{{order.pid}}</el-descriptions-item>
        <el-descriptions-item label="取货地址">
          {{order.commUser.deliveryAddressPick.provinceName+
          order.commUser.deliveryAddressPick.cityName+
          order.commUser.deliveryAddressPick.region+
          order.commUser.deliveryAddressPick.address
          }}
        </el-descriptions-item>
        <el-descriptions-item label="商家">{{order.commUser.uname}}</el-descriptions-item>
        <el-descriptions-item label="订单状态">
          <el-tag type="warning" v-if="order.orderState=='o-1'">待付款</el-tag>
          <el-tag type="success" v-if="order.orderState=='o-2'">待提货</el-tag>
          <el-tag type="success" v-if="order.orderState=='o-3'">已提货</el-tag>
          <el-tag type="success" v-if="order.orderState=='o-4'">全部退货</el-tag>
          <el-tag type="success" v-if="order.orderState=='o-5'">订单完成</el-tag>
          <el-tag type="success" v-if="order.orderState=='o-6'">已付款</el-tag>
          <el-tag type="success" v-if="order.orderState=='o-7'">交易关闭</el-tag>
          <el-tag type="success" v-if="order.orderState=='o-8'">已评价</el-tag>
        </el-descriptions-item>
      </el-descriptions>
    </el-dialog>
  </div>
</template>

<script>
  export default {
    name: "OrderDetailView",
    data() {
      return {
        dialogVisible: false,
        order: {
          pid: "",
          orderState: "",
          commUser: {
            uname: "",
            deliveryAddressPick: {
              provinceName: "",
              cityName:"",
              region:"",
              address:""
            }
          },

        }
      }
    },
    methods: {
      getData(id) {
        this.$axios("order.action/" + id)
          .then(res => {
            this.order = res.data;
          })
          .catch(err => {
            this.$message.error(err)
          })
      },
      handleClose() {
        this.dialogVisible = false;
      },

    }
  }
</script>

<style scoped>

</style>
